



use "${pathdata_baseline}/BaselineExperimentRecall.dta", clear

preserve
	gen statistic = 0
	replace statistic = 1 if inlist(condition_, "statistic_neg", "statistic_pos")
	keep if story_type=="consistent"
	bysort prolific_pid : drop if _N==1
	
	* What fraction states exaclty same belief?
gen diff_belief = effect - effect_recall	
*bysort statistic: tab diff_belief

	collapse (mean) effect effect_recall (sem) imm_sem = effect del_sem = effect_recall, by(statistic recallcombined)
	rename imm_sem sem0
	rename del_sem sem1
	rename effect dev0
	rename effect_recall dev1
	reshape long sem dev, i(statistic recallcombined) j(delay)
	gen upper=dev+sem
	gen lower=dev-sem

	tw 	(scatter dev delay if statistic == 0 & recallcombined==0, connect(l) lcolor(black*0.5) lpattern(solid)  msize(vlarge) ms(d) mcolor(black*0.5)) ///
						(rcap upper lower delay if statistic == 0  & recallcombined==0, lw(medthick) lcolor(black*0.5))	///
		(scatter dev delay if statistic == 1  & recallcombined==0, connect(l) lcolor(black*0.5) lpattern(dash)   msize(vlarge) ms(o) mcolor(black*0.5)) ///
				(rcap upper lower delay if statistic == 1 & recallcombined==0, lw(medthick) lcolor(black*0.5)) ///
			(scatter dev delay if statistic == 0 & recallcombined==1, connect(l) lcolor(black*1.5) lpattern(solid)  msize(vlarge) ms(d) mcolor(black*1.5)) ///
			(rcap upper lower delay if statistic == 0  & recallcombined==1, lw(medthick) lcolor(black*1.5))	///
		(scatter dev delay if statistic == 1  & recallcombined==1, connect(l) lcolor(black*1.5) lpattern(dash)   msize(vlarge) ms(o) mcolor(black*1.5)) ///
				(rcap upper lower delay if statistic == 1 & recallcombined==1, lw(medthick) lcolor(black*1.5)),	///	
		ytitle("Mean belief impact {c 177} SEM" "(percentage points)") ///
		xtitle(" ") xsc(r(-0.5 1.5) lcolor(none)) ysc(r(0 20) lcolor(none)) ///
		yline(0, lcolor(gs10) lwidth(thin)) ///
		graphregion(color(white)) ///
		ylabel(0 5 10 15 20, tlc(none) angle(0) glcolor(gs15) glwidth(thin)) ///
		legend(order(5 7 1 3) label(5 "Story: correct recall") label(7 "Statistic: correct recall") ///
		label(1 "Story: incorrect recall") label(3 "Statistic: incorrect recall")r(2)) ///
		xlabel(0 "Immediate" 1 "1-day delay") ysize(5) xsize(10) ///
						title("Belief impact in {it:Immediate} and {it:Delay}",  margin(b=3) color(black)) 
	graph export "${pathout_baseline}/figures/figure6.pdf", replace
	
